﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Erebos.TrittEinScreenFiles
{
    class TrittEinScreen : Screen
    {
        public TrittEinScreen()
        {
            Vector2 size1 = MainGame.Fonts["Arial16"].MeasureString("Tritt ein.");
            Vector2 size2 = MainGame.Fonts["Arial16"].MeasureString("Oder kehr um.");
            Vector2 size3 = MainGame.Fonts["Arial16"].MeasureString("Dies ist Erebos.");
            Vector2 pos1 = new Vector2(ScreenSizeHelper.SizeWidth / 2 - size1.X / 2, ScreenSizeHelper.GetPixelVertical(10) + MainGame.ErebosLogo.Height + ScreenSizeHelper.GetPixelVertical(15, MainGame.ErebosLogo.Height));
            Vector2 pos2 = new Vector2(ScreenSizeHelper.SizeWidth / 2 - size2.X / 2, ScreenSizeHelper.GetPixelVertical(10) + MainGame.ErebosLogo.Height + ScreenSizeHelper.GetPixelVertical(15, MainGame.ErebosLogo.Height) + 40);
            Vector2 pos3 = new Vector2(ScreenSizeHelper.SizeWidth / 2 - size2.X / 2, ScreenSizeHelper.GetPixelVertical(10) + MainGame.ErebosLogo.Height + ScreenSizeHelper.GetPixelVertical(15, MainGame.ErebosLogo.Height) + 80);
            AddEvent(new Rectangle((int)pos1.X, (int)pos1.Y, (int)size1.X, (int)size1.Y), OnClickTrittEin);
            AddEvent(new Rectangle((int)pos2.X, (int)pos2.Y, (int)size2.X, (int)size2.Y), OnClickOderKehrUm);
            AddEvent(new Rectangle((int)pos3.X, (int)pos3.Y, (int)size3.X, (int)size3.Y), OnClickDiesIstErebos);
        }

        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            spriteBatch.Draw(MainGame.Textures["Blood"], new Rectangle(0, 0, 100, 61), Color.White);
            spriteBatch.Draw(MainGame.Textures["Blood"], new Rectangle(ScreenSizeHelper.SizeWidth - 100, 0, 100, 61), Color.White);
            spriteBatch.Draw(MainGame.Textures["Blood"], new Rectangle(0, ScreenSizeHelper.SizeHeight - 61, 100, 61), Color.White);
            spriteBatch.Draw(MainGame.Textures["Blood"], new Rectangle(ScreenSizeHelper.SizeWidth - 100, ScreenSizeHelper.SizeHeight - 61, 100, 61), Color.White);
            spriteBatch.Draw(MainGame.ErebosLogo, new Vector2(ScreenSizeHelper.SizeWidth / 2 - MainGame.ErebosLogo.Width / 2, ScreenSizeHelper.GetPixelVertical(10)), Color.White);
            DrawStringCenter(spriteBatch, MainGame.Fonts["Arial16"], "Tritt ein.", ScreenSizeHelper.GetPixelVertical(10) + MainGame.ErebosLogo.Height + ScreenSizeHelper.GetPixelVertical(15, MainGame.ErebosLogo.Height), new Color(139, 0, 0));
            DrawStringCenter(spriteBatch, MainGame.Fonts["Arial16"], "Oder kehr um.", ScreenSizeHelper.GetPixelVertical(10) + MainGame.ErebosLogo.Height + ScreenSizeHelper.GetPixelVertical(15, MainGame.ErebosLogo.Height) + 40, new Color(139, 0, 0));
            DrawStringCenter(spriteBatch, MainGame.Fonts["Arial16"], "Dies ist Erebos.", ScreenSizeHelper.GetPixelVertical(10) + MainGame.ErebosLogo.Height + ScreenSizeHelper.GetPixelVertical(15, MainGame.ErebosLogo.Height) + 80, new Color(139, 0, 0));
            spriteBatch.DrawString(MainGame.Fonts["Arial10"], "© Jonas Bernemann", new Vector2(105, ScreenSizeHelper.SizeHeight - MainGame.Fonts["Arial10"].MeasureString("©Jonas Bernemann").Y - 5), Color.White);
            base.Draw(spriteBatch, gameTime);
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        #region Events
        private void OnClickTrittEin(object sender, EventArgs e)
        {
            MainGame.SetScreen(new MainMenuScreenFiles.MainMenuScreen());
        }

        private void OnClickOderKehrUm(object sender, EventArgs e)
        {
            CloseGame();
        }

        private void OnClickDiesIstErebos(object sender, EventArgs e)
        {
            MainGame.SetScreen(new CreditsScreenFiles.CreditsScreen());
        }
        #endregion
    }
}
